package com.cuz.hot100;

public class Q11containerWithTheMostWater {
    public static int maxArea1(int[] height) {
        if (height == null || height.length < 2) {
            return 0;
        }
        int left = 0;
        int right = height.length - 1;
        int max = Integer.MIN_VALUE;
        while (left < right) {
            int temp = (right - left) * Math.min(height[left], height[right]);
            max = Math.max(max, temp);
            if (height[left] < height[right]) {
                left++;
            } else {
                right--;
            }
        }
        return max;
    }
}
